package com.lagou.edu.utils;

import com.lagou.edu.factory.MyApplicationContext;

/**
 * @author dingxiaowei
 */
public class MyApplicationContextUtils {

    public static MyApplicationContext getMyApplicationContext() {

        MyApplicationContext myApplicationContext = new MyApplicationContext();

        // 解析component注解，创建bean实例化对象，放入IoC容器
        try {
            myApplicationContext.createBean("com.lagou.edu");
        } catch (Exception e) {
            e.printStackTrace();
        }

        // 解析autowired注解，维护bean对象关系
        try {
            myApplicationContext.autowireBean();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

        myApplicationContext.createTransactionProxyBean();

        return myApplicationContext;
    }
}
